package cn.lingyangwl.agile.infra.module.file;

import cn.lingyangwl.framework.tool.core.StringUtils;
import cn.lingyangwl.framework.tool.core.exception.BizException;
import cn.lingyangwl.agile.model.constants.CommonCons;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import javax.annotation.PostConstruct;

/**
 * @author shenguangyang
 */
@Data
@ConfigurationProperties(prefix = CommonCons.PROPERTIES_PREFIX + "file")
public class FileProperties {

    /**
     * 单独配置内网url, 子服务必须配置
     */
    private String intranetUrl = "http://127.0.0.1:9090";

    /**
     * 桶名
     */
    private String bucketName = "lingyang-boot";

    @PostConstruct
    public void init() {
        if (StringUtils.isEmpty(this.getIntranetUrl())) {
            throw new BizException("未配置内网文件地址");
        }
    }
}
